package com.suse.ecommerce.controller;

import com.suse.ecommerce.pojo.Category;
import com.suse.ecommerce.service.CategoryService;
import com.suse.ecommerce.serviceImp.CategoryServiceImp;
import com.suse.ecommerce.uilts.Msg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/category")
public class CategoryController {

    @Autowired
    CategoryServiceImp serviceImp;

    /**
     * 查询分类
     */
    @RequestMapping(value = "/queryCategories")
    public Msg queryCategorys(Category category){
        List<Category> categoryList = serviceImp.queryCategory(category);
        return Msg.success("200").add("list",categoryList);
    }
}
